@echo off
title AI助手安装工具
color 0A
setlocal enabledelayedexpansion

:: 检查管理员权限
net session >nul 2>&1
if %errorlevel% neq 0 (
    echo 请使用管理员权限运行此脚本
    pause
    exit /b
)

:: 创建安装目录
set INSTALL_DIR=%ProgramFiles%\AI_Assistants
if not exist "%INSTALL_DIR%" (
    mkdir "%INSTALL_DIR%"
    echo 创建安装目录: %INSTALL_DIR%
)

:: 下载函数
:download
set url=%1
set output=%2
echo 正在下载 %output%...
powershell -Command "(New-Object Net.WebClient).DownloadFile('%url%', '%INSTALL_DIR%\%output%')"
goto :eof

:: 菜单选择
:menu
cls
echo.
echo ============ AI助手安装工具 ============
echo 1. 安装豆包
echo 2. 安装文小言
echo 3. 安装DeepSeek
echo 4. 安装全部
echo 5. 退出
echo ========================================
set /p choice=请选择要安装的AI助手(1-5):

if "%choice%"=="1" goto install_doubao
if "%choice%"=="2" goto install_wenxiaoyan
if "%choice%"=="3" goto install_deepseek
if "%choice%"=="4" goto install_all
if "%choice%"=="5" exit /b

echo 无效选择，请重新输入
pause
goto menu

:: 安装豆包
:install_doubao
call :download "https://example.com/doubao/latest.exe" "Doubao_Setup.exe"
echo 正在安装豆包...
start /wait "" "%INSTALL_DIR%\Doubao_Setup.exe" /S
echo 豆包安装完成
pause
goto menu

:: 安装文小言
:install_wenxiaoyan
call :download "https://example.com/wenxiaoyan/latest.msi" "Wenxiaoyan_Setup.msi"
echo 正在安装文小言...
msiexec /i "%INSTALL_DIR%\Wenxiaoyan_Setup.msi" /quiet
echo 文小言安装完成
pause
goto menu

:: 安装DeepSeek
:install_deepseek
call :download "https://example.com/deepseek/latest.zip" "DeepSeek.zip"
echo 正在安装DeepSeek...
powershell -Command "Expand-Archive -Path '%INSTALL_DIR%\DeepSeek.zip' -DestinationPath '%INSTALL_DIR%\DeepSeek'"
echo 设置环境变量...
setx PATH "%PATH%;%INSTALL_DIR%\DeepSeek\bin" /M
echo DeepSeek安装完成
pause
goto menu

:: 安装全部
:install_all
call :install_doubao
call :install_wenxiaoyan
call :install_deepseek
goto menu